package com.example.livestockbreedingapplication.slice;

import com.example.livestockbreedingapplication.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Component;
import ohos.agp.components.DirectionalLayout;
import ohos.app.dispatcher.TaskDispatcher;
import ohos.app.dispatcher.task.TaskPriority;
import ohos.global.resource.Resource;

public class MainAbilitySlice extends AbilitySlice implements Component.ClickedListener {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        DirectionalLayout directionalLayout=(DirectionalLayout)findComponentById(ResourceTable.Id_main);
        directionalLayout.setClickedListener(this);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }


    @Override
    public void onClick(Component component) {
        if (component.getId() == ResourceTable.Id_main){
            Intent intent1 = new Intent();
            Operation operation = new Intent.OperationBuilder()
                    .withDeviceId("")
                    .withBundleName("com.example.livestockbreedingapplication")
                    .withAbilityName("com.example.livestockbreedingapplication.SystemMainAbility")
                    .build();
            intent1.setOperation(operation);
            startAbility(intent1);
        }
    }
}
